﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Common;

public class RegisterRequest : BaseRequest
{
    private RegisterPanel regiterPanel;

	public override void Awake ()
    {
        requestCode = RequestCode.User;
        actionCode = ActionCode.Register;
        regiterPanel = GetComponent<RegisterPanel>();
        base.Awake();
	}

    /// <summary>
    /// 发送请求
    /// </summary>
    /// <param name="username"></param>
    /// <param name="pwd"></param>
    public void SendRequest(string username, string pwd)
    {
        string data = username + "," + pwd;
        base.SendRequest(data);
    }

    /// <summary>
    /// 获得请求后服务器端的反馈
    /// </summary>
    /// <param name="data"></param>
    public override void OnResponse(string data)
    {
        ReturnCode returnCode = (ReturnCode)int.Parse(data);
        regiterPanel.OnRegisterResponse(returnCode);
    }
}
